  <% provide(:title, @product.name) %> 
  
<% flash.each do |key, value| %>
   <%= content_tag(:div, value, class: "alert alert-#{key}") %>
   <% end %>
 <div class="row-fluid">
    <div class="span3">
      <%= render 'shared/categories' %>
      <%= render 'shared/newproducts_left' %>
</div>
  <div class="span9" style="float:right">

    <h3 class="header-title"><%=(t 'productdetail')%></h3>
    <div class="popover-content">
      <div class="detail-brief">
        <div class="show-img">
          <%= image_tag(@product.imageurl, alt: @product.name) %>
        </div>
        <div class="show-brief">
          <b><%=(t 'name')%>:</b><span class="title"> <%= @product.name %></span><br/>
          <b><%=(t 'admin.code')%>:</b> <%= @product.id %><br/>
          <b><%=(t 'price')%>:</b> <%= @product.price %> <b><%= @product.currency %></b><br/>
        </div>
        <b><%=(t 'descs')%>:</b><div class="desc"> <%= @product.description %></div><br/>
      </div>
      <div align="center">
        <button class="btn btn-success" type="button" onClick="AddCart(<%= @product.id %>)"><%=(t 'addtocart')%> <i class="icon-shopping-cart"></i></button>
      </div>
    </div>
    <div style="clear:both"></div>
  <h4>
  <%=(t 'feedback')%>
  </h4>
  <%unless @comments.count <= 0 %>
      <table class="table table-striped">
    <%@comments.each do |comment|%>
     <tr>
     <th class = "span2">
       <%=User.find(comment.user_id).name%>
     </th>
     <td>
       <%=comment.content%>
     </td>
   </tr>
    <%end%>
  </table>
  <%else%>
  <%=(t 'nofeedback')%>
  <%end%>

 <%= form_for(@comment, :url => url_for(:controller => 'products', :action => 'leave_comment')) do |f| %>

      <div class='span8'>
      <span class="label label-info"><%=(t "yourfeeling")%></span>
      <%= f.text_area :content, "rows" => 5  %>
      <%= render 'shared/error_messages', object: f.object %>
      <%= f.hidden_field :product_id %>
      <%= f.hidden_field :user_id %>
     <button type="submit" class="btn btn-info"><%=(t 'leavecomment')%></button>
    </div>
  <%end%>

  </div>


  <% if @other_product.count > 0 %>
  <div class="span9" style="float:right">
    <h3 class="header-title">Similar products</h3>
    <div class="popover-content">
      <% @other_product.each do |item| %>
      <div class="box-product">
        <div class="brief">
          <div class="img-polaroid">
            <%= link_to image_tag(item.imageurl, alt: item.name), :controller => "products", :action => "show", :id => item.id %>
          </div>
    </div>
       <div align="center">
         <span class="label label-info price"><%= item.price %> <b><%= item.currency %></b></span><br/>
          <button class="btn primary details" data-tooltip="sticky<%= item.id %>"><i class="icon-zoom-in"></i></button>
           <a href="javascript:void(0)" class="btn addto" onClick="AddCart(<%= item.id %>)">Add to <i class="icon-shopping-cart"></i></a>
         </div>
        <%= link_to truncate(item.name, :length => 40), :controller => "products", :action => "show", :id => item.id %><br/>
        </div>
        <% end %>
      </div>
      <div style="clear:both"></div>
    </div>
    <% end %>

    <!--HTML for the tooltips-->
  <div id="mystickytooltip" class="stickytooltip">
    <div style="padding:5px">
      <% if @other_product.count > 0 %>
      <% @other_product.each do |item| %>
      <div id="sticky<%= item.id %>" class="atip">
        <%= image_tag(item.imageurl, alt: item.name)%><br/>
        <b><%= item.name %></b><br/>
        <b>Price: <%= item.price %> <%= item.currency %></b>
      </div>
      <% end %>
      <% end %>
    </div>
    <div class="stickystatus"></div>
  </div>